package com.jd.tools;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

public class FileTool {

	public List<String> getFileNames() throws IOException {
		List<String> fileList = new ArrayList<String>();
		Properties prop = getProperties("Path.properties");
		File[] fs = new File(prop.getProperty("buildPath")).listFiles();
		for (int i = 0; i < fs.length; i++) {
			System.out.println(fs[i].getName());
			if(fs[i].listFiles()==null||(fs[i].listFiles()).length<=0) {
				System.out.println(fs[i]+"文件夹为空，跳过!");
				continue;
			}
			fileList.add(fs[i].getName());
		}
		return fileList;
	}
	public Properties getProperties(String propertiesFileName) throws IOException {
		Properties prop = new Properties();
		InputStream in = getClass().getResourceAsStream("/"+propertiesFileName);
		prop.load(in);
		return prop;
	}
}